class Solution
{
public:
    int partitionDisjoint(vector<int> &nums)
    {
        int pos = 0;
        int verify = nums[0];
        int nextVerify = nums[0];
        int n = nums.size();
        for (int i = 0; i < n; ++i)
        {
            if (nums[i] < verify)
            {
                pos = i;
                verify = nextVerify;
            }
            if (nums[i] > nextVerify)
            {
                nextVerify = nums[i];
            }
        }
        return pos + 1;
    }
};